
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
  
<!-- Mirrored from werkzeug.palletsprojects.com/en/1.0.x/urls/ by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 15 Sep 2020 06:37:09 GMT -->
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>URL Helpers &#8212; Werkzeug Documentation (1.0.x)</title>
    <link rel="stylesheet" href="../_static/werkzeug.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../../../../assets.readthedocs.org/static/css/badge_only.css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <script async="async" type="text/javascript" src="../../../../assets.readthedocs.org/static/javascript/readthedocs-doc-embed.js"></script>
    <link rel="shortcut icon" href="../_static/favicon.ico"/>
    <link rel="index" title="Index" href="../genindex/index.html" />
    <link rel="search" title="Search" href="../search/index.html" />
    <link rel="next" title="Context Locals" href="../local/index.html" />
    <link rel="prev" title="Utilities" href="../utils/index.html" />
    <link rel="canonical" href="index.html">
  <script>DOCUMENTATION_OPTIONS.URL_ROOT = '../index.html';</script>
   
  
<!-- RTD Extra Head -->

<!-- 
Always link to the latest version, as canonical.
http://docs.readthedocs.org/en/latest/canonical.html
-->
<link rel="canonical" href="index.html" />

<link rel="stylesheet" href="../../../../assets.readthedocs.org/static/css/readthedocs-doc-embed.css" type="text/css" />

<script type="text/javascript" src="../_static/readthedocs-data.js"></script>

<!-- Add page-specific data, which must exist in the page js, not global -->
<script type="text/javascript">
READTHEDOCS_DATA['page'] = "urls"
READTHEDOCS_DATA['source_suffix'] = ".rst"
</script>

<script type="text/javascript" src="../../../../assets.readthedocs.org/static/javascript/readthedocs-analytics.js" async="async"></script>

<!-- end RTD <extrahead> -->
</head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex/index.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex/index.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../local/index.html" title="Context Locals"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="../utils/index.html" title="Utilities"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">Werkzeug Documentation (1.0.x)</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="module-werkzeug.urls">
<span id="url-helpers"></span><h1>URL Helpers<a class="headerlink" href="#module-werkzeug.urls" title="Permalink to this headline">¶</a></h1>
<div class="section" id="werkzeug-urls">
<h2>werkzeug.urls<a class="headerlink" href="#werkzeug-urls" title="Permalink to this headline">¶</a></h2>
<p><code class="docutils literal notranslate"><span class="pre">werkzeug.urls</span></code> used to provide several wrapper functions for Python 2
urlparse, whose main purpose were to work around the behavior of the Py2
stdlib and its lack of unicode support. While this was already a somewhat
inconvenient situation, it got even more complicated because Python 3’s
<code class="docutils literal notranslate"><span class="pre">urllib.parse</span></code> actually does handle unicode properly. In other words,
this module would wrap two libraries with completely different behavior. So
now this module contains a 2-and-3-compatible backport of Python 3’s
<code class="docutils literal notranslate"><span class="pre">urllib.parse</span></code>, which is mostly API-compatible.</p>
<dl class="class">
<dt id="werkzeug.urls.BaseURL">
<em class="property">class </em><code class="descclassname">werkzeug.urls.</code><code class="descname">BaseURL</code><a class="headerlink" href="#werkzeug.urls.BaseURL" title="Permalink to this definition">¶</a></dt>
<dd><p>Superclass of <a class="reference internal" href="#werkzeug.urls.URL" title="werkzeug.urls.URL"><code class="xref py py-class docutils literal notranslate"><span class="pre">URL</span></code></a> and <a class="reference internal" href="#werkzeug.urls.BytesURL" title="werkzeug.urls.BytesURL"><code class="xref py py-class docutils literal notranslate"><span class="pre">BytesURL</span></code></a>.</p>
<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.ascii_host">
<code class="descname">ascii_host</code><a class="headerlink" href="#werkzeug.urls.BaseURL.ascii_host" title="Permalink to this definition">¶</a></dt>
<dd><p>Works exactly like <a class="reference internal" href="#werkzeug.urls.BaseURL.host" title="werkzeug.urls.BaseURL.host"><code class="xref py py-attr docutils literal notranslate"><span class="pre">host</span></code></a> but will return a result that
is restricted to ASCII.  If it finds a netloc that is not ASCII
it will attempt to idna decode it.  This is useful for socket
operations when the URL might include internationalized characters.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.auth">
<code class="descname">auth</code><a class="headerlink" href="#werkzeug.urls.BaseURL.auth" title="Permalink to this definition">¶</a></dt>
<dd><p>The authentication part in the URL if available, <cite>None</cite>
otherwise.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.decode_netloc">
<code class="descname">decode_netloc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.decode_netloc" title="Permalink to this definition">¶</a></dt>
<dd><p>Decodes the netloc part into a string.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.decode_query">
<code class="descname">decode_query</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.decode_query" title="Permalink to this definition">¶</a></dt>
<dd><p>Decodes the query part of the URL.  Ths is a shortcut for
calling <a class="reference internal" href="#werkzeug.urls.url_decode" title="werkzeug.urls.url_decode"><code class="xref py py-func docutils literal notranslate"><span class="pre">url_decode()</span></code></a> on the query argument.  The arguments and
keyword arguments are forwarded to <a class="reference internal" href="#werkzeug.urls.url_decode" title="werkzeug.urls.url_decode"><code class="xref py py-func docutils literal notranslate"><span class="pre">url_decode()</span></code></a> unchanged.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.get_file_location">
<code class="descname">get_file_location</code><span class="sig-paren">(</span><em>pathformat=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.get_file_location" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a tuple with the location of the file in the form
<code class="docutils literal notranslate"><span class="pre">(server,</span> <span class="pre">location)</span></code>.  If the netloc is empty in the URL or
points to localhost, it’s represented as <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
<p>The <cite>pathformat</cite> by default is autodetection but needs to be set
when working with URLs of a specific system.  The supported values
are <code class="docutils literal notranslate"><span class="pre">'windows'</span></code> when working with Windows or DOS paths and
<code class="docutils literal notranslate"><span class="pre">'posix'</span></code> when working with posix paths.</p>
<p>If the URL does not point to a local file, the server and location
are both represented as <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pathformat</strong> – The expected format of the path component.
Currently <code class="docutils literal notranslate"><span class="pre">'windows'</span></code> and <code class="docutils literal notranslate"><span class="pre">'posix'</span></code> are
supported.  Defaults to <code class="docutils literal notranslate"><span class="pre">None</span></code> which is
autodetect.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.host">
<code class="descname">host</code><a class="headerlink" href="#werkzeug.urls.BaseURL.host" title="Permalink to this definition">¶</a></dt>
<dd><p>The host part of the URL if available, otherwise <cite>None</cite>.  The
host is either the hostname or the IP address mentioned in the
URL.  It will not contain the port.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.join">
<code class="descname">join</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.join" title="Permalink to this definition">¶</a></dt>
<dd><p>Joins this URL with another one.  This is just a convenience
function for calling into <a class="reference internal" href="#werkzeug.urls.url_join" title="werkzeug.urls.url_join"><code class="xref py py-meth docutils literal notranslate"><span class="pre">url_join()</span></code></a> and then parsing the
return value again.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.password">
<code class="descname">password</code><a class="headerlink" href="#werkzeug.urls.BaseURL.password" title="Permalink to this definition">¶</a></dt>
<dd><p>The password if it was part of the URL, <cite>None</cite> otherwise.
This undergoes URL decoding and will always be a unicode string.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.port">
<code class="descname">port</code><a class="headerlink" href="#werkzeug.urls.BaseURL.port" title="Permalink to this definition">¶</a></dt>
<dd><p>The port in the URL as an integer if it was present, <cite>None</cite>
otherwise.  This does not fill in default ports.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.raw_password">
<code class="descname">raw_password</code><a class="headerlink" href="#werkzeug.urls.BaseURL.raw_password" title="Permalink to this definition">¶</a></dt>
<dd><p>The password if it was part of the URL, <cite>None</cite> otherwise.
Unlike <a class="reference internal" href="#werkzeug.urls.BaseURL.password" title="werkzeug.urls.BaseURL.password"><code class="xref py py-attr docutils literal notranslate"><span class="pre">password</span></code></a> this one is not being decoded.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.raw_username">
<code class="descname">raw_username</code><a class="headerlink" href="#werkzeug.urls.BaseURL.raw_username" title="Permalink to this definition">¶</a></dt>
<dd><p>The username if it was part of the URL, <cite>None</cite> otherwise.
Unlike <a class="reference internal" href="#werkzeug.urls.BaseURL.username" title="werkzeug.urls.BaseURL.username"><code class="xref py py-attr docutils literal notranslate"><span class="pre">username</span></code></a> this one is not being decoded.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.replace">
<code class="descname">replace</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.replace" title="Permalink to this definition">¶</a></dt>
<dd><p>Return an URL with the same values, except for those parameters
given new values by whichever keyword arguments are specified.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.to_iri_tuple">
<code class="descname">to_iri_tuple</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.to_iri_tuple" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a <a class="reference internal" href="#werkzeug.urls.URL" title="werkzeug.urls.URL"><code class="xref py py-class docutils literal notranslate"><span class="pre">URL</span></code></a> tuple that holds a IRI.  This will try
to decode as much information as possible in the URL without
losing information similar to how a web browser does it for the
URL bar.</p>
<p>It’s usually more interesting to directly call <a class="reference internal" href="#werkzeug.urls.uri_to_iri" title="werkzeug.urls.uri_to_iri"><code class="xref py py-meth docutils literal notranslate"><span class="pre">uri_to_iri()</span></code></a> which
will return a string.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.to_uri_tuple">
<code class="descname">to_uri_tuple</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.to_uri_tuple" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a <a class="reference internal" href="#werkzeug.urls.BytesURL" title="werkzeug.urls.BytesURL"><code class="xref py py-class docutils literal notranslate"><span class="pre">BytesURL</span></code></a> tuple that holds a URI.  This will
encode all the information in the URL properly to ASCII using the
rules a web browser would follow.</p>
<p>It’s usually more interesting to directly call <a class="reference internal" href="#werkzeug.urls.iri_to_uri" title="werkzeug.urls.iri_to_uri"><code class="xref py py-meth docutils literal notranslate"><span class="pre">iri_to_uri()</span></code></a> which
will return a string.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.to_url">
<code class="descname">to_url</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.to_url" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a URL string or bytes depending on the type of the
information stored.  This is just a convenience function
for calling <a class="reference internal" href="#werkzeug.urls.url_unparse" title="werkzeug.urls.url_unparse"><code class="xref py py-meth docutils literal notranslate"><span class="pre">url_unparse()</span></code></a> for this URL.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.username">
<code class="descname">username</code><a class="headerlink" href="#werkzeug.urls.BaseURL.username" title="Permalink to this definition">¶</a></dt>
<dd><p>The username if it was part of the URL, <cite>None</cite> otherwise.
This undergoes URL decoding and will always be a unicode string.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.urls.BytesURL">
<em class="property">class </em><code class="descclassname">werkzeug.urls.</code><code class="descname">BytesURL</code><a class="headerlink" href="#werkzeug.urls.BytesURL" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a parsed URL in bytes.</p>
<dl class="method">
<dt id="werkzeug.urls.BytesURL.decode">
<code class="descname">decode</code><span class="sig-paren">(</span><em>charset='utf-8'</em>, <em>errors='replace'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BytesURL.decode" title="Permalink to this definition">¶</a></dt>
<dd><p>Decodes the URL to a tuple made out of strings.  The charset is
only being used for the path, query and fragment.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BytesURL.encode_netloc">
<code class="descname">encode_netloc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BytesURL.encode_netloc" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the netloc unchanged as bytes.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.urls.Href">
<em class="property">class </em><code class="descclassname">werkzeug.urls.</code><code class="descname">Href</code><span class="sig-paren">(</span><em>base='./'</em>, <em>charset='utf-8'</em>, <em>sort=False</em>, <em>key=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.Href" title="Permalink to this definition">¶</a></dt>
<dd><p>Implements a callable that constructs URLs with the given base. The
function can be called with any number of positional and keyword
arguments which than are used to assemble the URL.  Works with URLs
and posix paths.</p>
<p>Positional arguments are appended as individual segments to
the path of the URL:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">href</span> <span class="o">=</span> <span class="n">Href</span><span class="p">(</span><span class="s1">&#39;/foo&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">href</span><span class="p">(</span><span class="s1">&#39;bar&#39;</span><span class="p">,</span> <span class="mi">23</span><span class="p">)</span>
<span class="go">&#39;/foo/bar/23&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">href</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">,</span> <span class="n">bar</span><span class="o">=</span><span class="mi">23</span><span class="p">)</span>
<span class="go">&#39;/foo/foo?bar=23&#39;</span>
</pre></div>
</div>
<p>If any of the arguments (positional or keyword) evaluates to <cite>None</cite> it
will be skipped.  If no keyword arguments are given the last argument
can be a <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a> or <code class="xref py py-class docutils literal notranslate"><span class="pre">MultiDict</span></code> (or any other dict subclass),
otherwise the keyword arguments are used for the query parameters, cutting
off the first trailing underscore of the parameter name:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">href</span><span class="p">(</span><span class="n">is_</span><span class="o">=</span><span class="mi">42</span><span class="p">)</span>
<span class="go">&#39;/foo?is=42&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">href</span><span class="p">({</span><span class="s1">&#39;foo&#39;</span><span class="p">:</span> <span class="s1">&#39;bar&#39;</span><span class="p">})</span>
<span class="go">&#39;/foo?foo=bar&#39;</span>
</pre></div>
</div>
<p>Combining of both methods is not allowed:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">href</span><span class="p">({</span><span class="s1">&#39;foo&#39;</span><span class="p">:</span> <span class="s1">&#39;bar&#39;</span><span class="p">},</span> <span class="n">bar</span><span class="o">=</span><span class="mi">42</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
  <span class="c">...</span>
<span class="gr">TypeError</span>: <span class="n">keyword arguments and query-dicts can&#39;t be combined</span>
</pre></div>
</div>
<p>Accessing attributes on the href object creates a new href object with
the attribute name as prefix:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">bar_href</span> <span class="o">=</span> <span class="n">href</span><span class="o">.</span><span class="n">bar</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">bar_href</span><span class="p">(</span><span class="s2">&quot;blub&quot;</span><span class="p">)</span>
<span class="go">&#39;/foo/bar/blub&#39;</span>
</pre></div>
</div>
<p>If <cite>sort</cite> is set to <cite>True</cite> the items are sorted by <cite>key</cite> or the default
sorting algorithm:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">href</span> <span class="o">=</span> <span class="n">Href</span><span class="p">(</span><span class="s2">&quot;/&quot;</span><span class="p">,</span> <span class="n">sort</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">href</span><span class="p">(</span><span class="n">a</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">b</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
<span class="go">&#39;/?a=1&amp;b=2&amp;c=3&#39;</span>
</pre></div>
</div>
<details class="changelog">
<summary>Changelog</summary><div class="versionadded">
<p><span class="versionmodified">New in version 0.5: </span><cite>sort</cite> and <cite>key</cite> were added.</p>
</div>
</details></dd></dl>

<dl class="class">
<dt id="werkzeug.urls.URL">
<em class="property">class </em><code class="descclassname">werkzeug.urls.</code><code class="descname">URL</code><a class="headerlink" href="#werkzeug.urls.URL" title="Permalink to this definition">¶</a></dt>
<dd><p>Represents a parsed URL.  This behaves like a regular tuple but
also has some extra attributes that give further insight into the
URL.</p>
<dl class="method">
<dt id="werkzeug.urls.URL.encode">
<code class="descname">encode</code><span class="sig-paren">(</span><em>charset='utf-8'</em>, <em>errors='replace'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.URL.encode" title="Permalink to this definition">¶</a></dt>
<dd><p>Encodes the URL to a tuple made out of bytes.  The charset is
only being used for the path, query and fragment.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.URL.encode_netloc">
<code class="descname">encode_netloc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.URL.encode_netloc" title="Permalink to this definition">¶</a></dt>
<dd><p>Encodes the netloc part to an ASCII safe URL as bytes.</p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.iri_to_uri">
<code class="descclassname">werkzeug.urls.</code><code class="descname">iri_to_uri</code><span class="sig-paren">(</span><em>iri</em>, <em>charset='utf-8'</em>, <em>errors='strict'</em>, <em>safe_conversion=False</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.iri_to_uri" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert an IRI to a URI. All non-ASCII and unsafe characters are
quoted. If the URL has a domain, it is encoded to Punycode.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">iri_to_uri</span><span class="p">(</span><span class="s1">&#39;http://</span><span class="se">\u2603</span><span class="s1">.net/p</span><span class="se">\xe5</span><span class="s1">th?q=</span><span class="se">\xe8</span><span class="s1">ry%DF&#39;</span><span class="p">)</span>
<span class="go">&#39;http://xn--n3h.net/p%C3%A5th?q=%C3%A8ry%DF&#39;</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>iri</strong> – The IRI to convert.</li>
<li><strong>charset</strong> – The encoding of the IRI.</li>
<li><strong>errors</strong> – Error handler to use during <code class="docutils literal notranslate"><span class="pre">bytes.encode</span></code>.</li>
<li><strong>safe_conversion</strong> – Return the URL unchanged if it only contains
ASCII characters and no whitespace. See the explanation below.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>There is a general problem with IRI conversion with some protocols
that are in violation of the URI specification. Consider the
following two IRIs:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>magnet:?xt=uri:whatever
itms-services://?action=download-manifest
</pre></div>
</div>
<p>After parsing, we don’t know if the scheme requires the <code class="docutils literal notranslate"><span class="pre">//</span></code>,
which is dropped if empty, but conveys different meanings in the
final URL if it’s present or not. In this case, you can use
<code class="docutils literal notranslate"><span class="pre">safe_conversion</span></code>, which will return the URL unchanged if it only
contains ASCII characters and no whitespace. This can result in a
URI with unquoted characters if it was not already quoted correctly,
but preserves the URL’s semantics. Werkzeug uses this for the
<code class="docutils literal notranslate"><span class="pre">Location</span></code> header for redirects.</p>
<details class="changelog">
<summary>Changelog</summary><div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.15: </span>All reserved characters remain unquoted. Previously, only some
reserved characters were left unquoted.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.9.6: </span>The <code class="docutils literal notranslate"><span class="pre">safe_conversion</span></code> parameter was added.</p>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.6.</span></p>
</div>
</details></dd></dl>

<dl class="function">
<dt id="werkzeug.urls.uri_to_iri">
<code class="descclassname">werkzeug.urls.</code><code class="descname">uri_to_iri</code><span class="sig-paren">(</span><em>uri</em>, <em>charset='utf-8'</em>, <em>errors='werkzeug.url_quote'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.uri_to_iri" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a URI to an IRI. All valid UTF-8 characters are unquoted,
leaving all reserved and invalid characters quoted. If the URL has
a domain, it is decoded from Punycode.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">uri_to_iri</span><span class="p">(</span><span class="s2">&quot;http://xn--n3h.net/p%C3%A5th?q=%C3%A8ry%DF&quot;</span><span class="p">)</span>
<span class="go">&#39;http://\u2603.net/p\xe5th?q=\xe8ry%DF&#39;</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>uri</strong> – The URI to convert.</li>
<li><strong>charset</strong> – The encoding to encode unquoted bytes with.</li>
<li><strong>errors</strong> – Error handler to use during <code class="docutils literal notranslate"><span class="pre">bytes.encode</span></code>. By
default, invalid bytes are left quoted.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<details class="changelog">
<summary>Changelog</summary><div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.15: </span>All reserved and invalid characters remain quoted. Previously,
only some reserved characters were preserved, and invalid bytes
were replaced instead of left quoted.</p>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.6.</span></p>
</div>
</details></dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_decode">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_decode</code><span class="sig-paren">(</span><em>s</em>, <em>charset='utf-8'</em>, <em>decode_keys=False</em>, <em>include_empty=True</em>, <em>errors='replace'</em>, <em>separator='&amp;'</em>, <em>cls=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_decode" title="Permalink to this definition">¶</a></dt>
<dd><p>Parse a querystring and return it as <code class="xref py py-class docutils literal notranslate"><span class="pre">MultiDict</span></code>.  There is a
difference in key decoding on different Python versions.  On Python 3
keys will always be fully decoded whereas on Python 2, keys will
remain bytestrings if they fit into ASCII.  On 2.x keys can be forced
to be unicode by setting <cite>decode_keys</cite> to <cite>True</cite>.</p>
<p>If the charset is set to <cite>None</cite> no unicode decoding will happen and
raw bytes will be returned.</p>
<p>Per default a missing value for a key will default to an empty key.  If
you don’t want that behavior you can set <cite>include_empty</cite> to <cite>False</cite>.</p>
<p>Per default encoding errors are ignored.  If you want a different behavior
you can set <cite>errors</cite> to <code class="docutils literal notranslate"><span class="pre">'replace'</span></code> or <code class="docutils literal notranslate"><span class="pre">'strict'</span></code>.  In strict mode a
<cite>HTTPUnicodeError</cite> is raised.</p>
<details class="changelog">
<summary>Changelog</summary><div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.5: </span>In previous versions “;” and “&amp;” could be used for url decoding.
This changed in 0.5 where only “&amp;” is supported.  If you want to
use “;” instead a different <cite>separator</cite> can be provided.</p>
<p>The <cite>cls</cite> parameter was added.</p>
</div>
</details><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>s</strong> – a string with the query string to decode.</li>
<li><strong>charset</strong> – the charset of the query string.  If set to <cite>None</cite>
no unicode decoding will take place.</li>
<li><strong>decode_keys</strong> – Used on Python 2.x to control whether keys should
be forced to be unicode objects.  If set to <cite>True</cite>
then keys will be unicode in all cases. Otherwise,
they remain <cite>str</cite> if they fit into ASCII.</li>
<li><strong>include_empty</strong> – Set to <cite>False</cite> if you don’t want empty values to
appear in the dict.</li>
<li><strong>errors</strong> – the decoding error behavior.</li>
<li><strong>separator</strong> – the pair separator to be used, defaults to <code class="docutils literal notranslate"><span class="pre">&amp;</span></code></li>
<li><strong>cls</strong> – an optional dict class to use.  If this is not specified
or <cite>None</cite> the default <code class="xref py py-class docutils literal notranslate"><span class="pre">MultiDict</span></code> is used.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_decode_stream">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_decode_stream</code><span class="sig-paren">(</span><em>stream</em>, <em>charset='utf-8'</em>, <em>decode_keys=False</em>, <em>include_empty=True</em>, <em>errors='replace'</em>, <em>separator='&amp;'</em>, <em>cls=None</em>, <em>limit=None</em>, <em>return_iterator=False</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_decode_stream" title="Permalink to this definition">¶</a></dt>
<dd><p>Works like <a class="reference internal" href="#werkzeug.urls.url_decode" title="werkzeug.urls.url_decode"><code class="xref py py-func docutils literal notranslate"><span class="pre">url_decode()</span></code></a> but decodes a stream.  The behavior
of stream and limit follows functions like
<a class="reference internal" href="../wsgi/index.html#werkzeug.wsgi.make_line_iter" title="werkzeug.wsgi.make_line_iter"><code class="xref py py-func docutils literal notranslate"><span class="pre">make_line_iter()</span></code></a>.  The generator of pairs is
directly fed to the <cite>cls</cite> so you can consume the data while it’s
parsed.</p>
<details class="changelog">
<summary>Changelog</summary><div class="versionadded">
<p><span class="versionmodified">New in version 0.8.</span></p>
</div>
</details><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>stream</strong> – a stream with the encoded querystring</li>
<li><strong>charset</strong> – the charset of the query string.  If set to <cite>None</cite>
no unicode decoding will take place.</li>
<li><strong>decode_keys</strong> – Used on Python 2.x to control whether keys should
be forced to be unicode objects.  If set to <cite>True</cite>,
keys will be unicode in all cases. Otherwise, they
remain <cite>str</cite> if they fit into ASCII.</li>
<li><strong>include_empty</strong> – Set to <cite>False</cite> if you don’t want empty values to
appear in the dict.</li>
<li><strong>errors</strong> – the decoding error behavior.</li>
<li><strong>separator</strong> – the pair separator to be used, defaults to <code class="docutils literal notranslate"><span class="pre">&amp;</span></code></li>
<li><strong>cls</strong> – an optional dict class to use.  If this is not specified
or <cite>None</cite> the default <code class="xref py py-class docutils literal notranslate"><span class="pre">MultiDict</span></code> is used.</li>
<li><strong>limit</strong> – the content length of the URL data.  Not necessary if
a limited stream is provided.</li>
<li><strong>return_iterator</strong> – if set to <cite>True</cite> the <cite>cls</cite> argument is ignored
and an iterator over all decoded pairs is
returned</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_encode">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_encode</code><span class="sig-paren">(</span><em>obj</em>, <em>charset='utf-8'</em>, <em>encode_keys=False</em>, <em>sort=False</em>, <em>key=None</em>, <em>separator=b'&amp;'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_encode" title="Permalink to this definition">¶</a></dt>
<dd><p>URL encode a dict/<cite>MultiDict</cite>.  If a value is <cite>None</cite> it will not appear
in the result string.  Per default only values are encoded into the target
charset strings.  If <cite>encode_keys</cite> is set to <code class="docutils literal notranslate"><span class="pre">True</span></code> unicode keys are
supported too.</p>
<p>If <cite>sort</cite> is set to <cite>True</cite> the items are sorted by <cite>key</cite> or the default
sorting algorithm.</p>
<details class="changelog">
<summary>Changelog</summary><div class="versionadded">
<p><span class="versionmodified">New in version 0.5: </span><cite>sort</cite>, <cite>key</cite>, and <cite>separator</cite> were added.</p>
</div>
</details><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>obj</strong> – the object to encode into a query string.</li>
<li><strong>charset</strong> – the charset of the query string.</li>
<li><strong>encode_keys</strong> – set to <cite>True</cite> if you have unicode keys. (Ignored on
Python 3.x)</li>
<li><strong>sort</strong> – set to <cite>True</cite> if you want parameters to be sorted by <cite>key</cite>.</li>
<li><strong>separator</strong> – the separator to be used for the pairs.</li>
<li><strong>key</strong> – an optional function to be used for sorting.  For more details
check out the <a class="reference external" href="https://docs.python.org/3/library/functions.html#sorted" title="(in Python v3.8)"><code class="xref py py-func docutils literal notranslate"><span class="pre">sorted()</span></code></a> documentation.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_encode_stream">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_encode_stream</code><span class="sig-paren">(</span><em>obj</em>, <em>stream=None</em>, <em>charset='utf-8'</em>, <em>encode_keys=False</em>, <em>sort=False</em>, <em>key=None</em>, <em>separator=b'&amp;'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_encode_stream" title="Permalink to this definition">¶</a></dt>
<dd><p>Like <a class="reference internal" href="#werkzeug.urls.url_encode" title="werkzeug.urls.url_encode"><code class="xref py py-meth docutils literal notranslate"><span class="pre">url_encode()</span></code></a> but writes the results to a stream
object.  If the stream is <cite>None</cite> a generator over all encoded
pairs is returned.</p>
<details class="changelog">
<summary>Changelog</summary><div class="versionadded">
<p><span class="versionmodified">New in version 0.8.</span></p>
</div>
</details><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>obj</strong> – the object to encode into a query string.</li>
<li><strong>stream</strong> – a stream to write the encoded object into or <cite>None</cite> if
an iterator over the encoded pairs should be returned.  In
that case the separator argument is ignored.</li>
<li><strong>charset</strong> – the charset of the query string.</li>
<li><strong>encode_keys</strong> – set to <cite>True</cite> if you have unicode keys. (Ignored on
Python 3.x)</li>
<li><strong>sort</strong> – set to <cite>True</cite> if you want parameters to be sorted by <cite>key</cite>.</li>
<li><strong>separator</strong> – the separator to be used for the pairs.</li>
<li><strong>key</strong> – an optional function to be used for sorting.  For more details
check out the <a class="reference external" href="https://docs.python.org/3/library/functions.html#sorted" title="(in Python v3.8)"><code class="xref py py-func docutils literal notranslate"><span class="pre">sorted()</span></code></a> documentation.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_fix">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_fix</code><span class="sig-paren">(</span><em>s</em>, <em>charset='utf-8'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_fix" title="Permalink to this definition">¶</a></dt>
<dd><p>Sometimes you get an URL by a user that just isn’t a real URL because
it contains unsafe characters like ‘ ‘ and so on. This function can fix
some of the problems in a similar way browsers handle data entered by the
user:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">url_fix</span><span class="p">(</span><span class="sa">u</span><span class="s1">&#39;http://de.wikipedia.org/wiki/Elf (Begriffskl</span><span class="se">\xe4</span><span class="s1">rung)&#39;</span><span class="p">)</span>
<span class="go">&#39;http://de.wikipedia.org/wiki/Elf%20(Begriffskl%C3%A4rung)&#39;</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>s</strong> – the string with the URL to fix.</li>
<li><strong>charset</strong> – The target charset for the URL if the url was given as
unicode string.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_join">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_join</code><span class="sig-paren">(</span><em>base</em>, <em>url</em>, <em>allow_fragments=True</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_join" title="Permalink to this definition">¶</a></dt>
<dd><p>Join a base URL and a possibly relative URL to form an absolute
interpretation of the latter.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>base</strong> – the base URL for the join operation.</li>
<li><strong>url</strong> – the URL to join.</li>
<li><strong>allow_fragments</strong> – indicates whether fragments should be allowed.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_parse">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_parse</code><span class="sig-paren">(</span><em>url</em>, <em>scheme=None</em>, <em>allow_fragments=True</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_parse" title="Permalink to this definition">¶</a></dt>
<dd><p>Parses a URL from a string into a <a class="reference internal" href="#werkzeug.urls.URL" title="werkzeug.urls.URL"><code class="xref py py-class docutils literal notranslate"><span class="pre">URL</span></code></a> tuple.  If the URL
is lacking a scheme it can be provided as second argument. Otherwise,
it is ignored.  Optionally fragments can be stripped from the URL
by setting <cite>allow_fragments</cite> to <cite>False</cite>.</p>
<p>The inverse of this function is <a class="reference internal" href="#werkzeug.urls.url_unparse" title="werkzeug.urls.url_unparse"><code class="xref py py-func docutils literal notranslate"><span class="pre">url_unparse()</span></code></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>url</strong> – the URL to parse.</li>
<li><strong>scheme</strong> – the default schema to use if the URL is schemaless.</li>
<li><strong>allow_fragments</strong> – if set to <cite>False</cite> a fragment will be removed
from the URL.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_quote">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_quote</code><span class="sig-paren">(</span><em>string</em>, <em>charset='utf-8'</em>, <em>errors='strict'</em>, <em>safe='/:'</em>, <em>unsafe=''</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_quote" title="Permalink to this definition">¶</a></dt>
<dd><p>URL encode a single string with a given encoding.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>s</strong> – the string to quote.</li>
<li><strong>charset</strong> – the charset to be used.</li>
<li><strong>safe</strong> – an optional sequence of safe characters.</li>
<li><strong>unsafe</strong> – an optional sequence of unsafe characters.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<details class="changelog">
<summary>Changelog</summary><div class="versionadded">
<p><span class="versionmodified">New in version 0.9.2: </span>The <cite>unsafe</cite> parameter was added.</p>
</div>
</details></dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_quote_plus">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_quote_plus</code><span class="sig-paren">(</span><em>string</em>, <em>charset='utf-8'</em>, <em>errors='strict'</em>, <em>safe=''</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_quote_plus" title="Permalink to this definition">¶</a></dt>
<dd><p>URL encode a single string with the given encoding and convert
whitespace to “+”.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>s</strong> – The string to quote.</li>
<li><strong>charset</strong> – The charset to be used.</li>
<li><strong>safe</strong> – An optional sequence of safe characters.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_unparse">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_unparse</code><span class="sig-paren">(</span><em>components</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_unparse" title="Permalink to this definition">¶</a></dt>
<dd><p>The reverse operation to <a class="reference internal" href="#werkzeug.urls.url_parse" title="werkzeug.urls.url_parse"><code class="xref py py-meth docutils literal notranslate"><span class="pre">url_parse()</span></code></a>.  This accepts arbitrary
as well as <a class="reference internal" href="#werkzeug.urls.URL" title="werkzeug.urls.URL"><code class="xref py py-class docutils literal notranslate"><span class="pre">URL</span></code></a> tuples and returns a URL as a string.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>components</strong> – the parsed URL as tuple which should be converted
into a URL string.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_unquote">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_unquote</code><span class="sig-paren">(</span><em>string</em>, <em>charset='utf-8'</em>, <em>errors='replace'</em>, <em>unsafe=''</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_unquote" title="Permalink to this definition">¶</a></dt>
<dd><p>URL decode a single string with a given encoding.  If the charset
is set to <cite>None</cite> no unicode decoding is performed and raw bytes
are returned.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>s</strong> – the string to unquote.</li>
<li><strong>charset</strong> – the charset of the query string.  If set to <cite>None</cite>
no unicode decoding will take place.</li>
<li><strong>errors</strong> – the error handling for the charset decoding.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_unquote_plus">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_unquote_plus</code><span class="sig-paren">(</span><em>s</em>, <em>charset='utf-8'</em>, <em>errors='replace'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_unquote_plus" title="Permalink to this definition">¶</a></dt>
<dd><p>URL decode a single string with the given <cite>charset</cite> and decode “+” to
whitespace.</p>
<p>Per default encoding errors are ignored.  If you want a different behavior
you can set <cite>errors</cite> to <code class="docutils literal notranslate"><span class="pre">'replace'</span></code> or <code class="docutils literal notranslate"><span class="pre">'strict'</span></code>.  In strict mode a
<code class="xref py py-exc docutils literal notranslate"><span class="pre">HTTPUnicodeError</span></code> is raised.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>s</strong> – The string to unquote.</li>
<li><strong>charset</strong> – the charset of the query string.  If set to <cite>None</cite>
no unicode decoding will take place.</li>
<li><strong>errors</strong> – The error handling for the <cite>charset</cite> decoding.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
  <span id="sidebar-top"></span>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  
    
            <p class="logo"><a href="../index.html">
              <img class="logo" src="../_static/werkzeug.png" alt="Logo"/>
            </a></p>
  

  <h3>Contents</h3>
  <ul>
<li><a class="reference internal" href="#">URL Helpers</a><ul>
<li><a class="reference internal" href="#werkzeug-urls">werkzeug.urls</a></li>
</ul>
</li>
</ul>
<h3>Navigation</h3>
<ul>
  <li><a href="../index.html">Overview</a>
    <ul>
          <li>Previous: <a href="../utils/index.html" title="previous chapter">Utilities</a>
          <li>Next: <a href="../local/index.html" title="next chapter">Context Locals</a>
    </ul>
  </li>
</ul>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="https://werkzeug.palletsprojects.com/en/1.0.x/search/" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
  
    <div class="footer" role="contentinfo">
        &#169; Copyright 2007 Pallets.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.5.
    </div>
    <script>
      if (typeof READTHEDOCS_DATA !== 'undefined') {
        if (!READTHEDOCS_DATA.features) {
          READTHEDOCS_DATA.features = {};
        }
        READTHEDOCS_DATA.features.docsearch_disabled = true;
      }
    </script>

  </body>

<!-- Mirrored from werkzeug.palletsprojects.com/en/1.0.x/urls/ by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 15 Sep 2020 06:37:09 GMT -->
</html>